package com.yeren.Reflection.Class;

public class TestEmployee {
	public static void main(String[] args) throws ClassNotFoundException {
		//第一种方式：  
//		Class c1 = Class.forName("Employee");  
		//第二种方式：  
		//java中每个类型都有class 属性.  
		Class<Employee> c2 = Employee.class;  
		
		System.out.println("c2:"+c2.getSimpleName());
		   
		//第三种方式：  
		//java语言中任何一个java对象都有getClass 方法  
		Employee e = new Employee();  
		Class<?> c3 = e.getClass(); //c3是运行时类 (e的运行时类是Employee)
		System.out.println("c3:"+c3.getName());
	}
}


class Employee {
	private String name;
	private int age;
	
	public Employee(){
		super();
	}
	
	public Employee(String name, int age) {
		super();
		this.name = name;
		this.age = age;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}
	
}